<template>
    <view>
        <shiFengIndex></shiFengIndex>
        <!-- 客户 -->
    </view>
</template>

<script>
import shiFengIndex from "./shiFengIndex.vue";
import { mapState } from "vuex";
import {
    followSalespersonsApi,
} from "@/api/enterprise.js";
export default {
    components: {
        shiFengIndex,
    },
    data() {
        return {
            appletName: this.$wxConfig.appletName,
            backgroundColor: this.$wxConfig.backgroundColor,
            appName: this.$wxConfig.appName,
			followSalespersons: "",
        };
    },
	onShareAppMessage: function () {
		return {
			title: this.$appletName,
			path: `pages/counselling/index?scene=${this.userInfo.id}`
		}
	},
	onShareTimeline: function () {
	    return {
	    	title: this.$appletName,
	    	path: "pages/counselling/index"
	    }
	},
	computed: {
	    ...mapState(["userInfo", "isLogin", "showVideo", "authority","fromshareId"]),
	},
    onLoad(op) {
        console.log(op, "op>>>");
        
        let fromshareIds = op.scene || "";
		if(fromshareIds){
			this.$store.commit('SET_FROMSHAREID', fromshareIds)
		}
		
		
		
        // 解决微信扫码登录 新用户登录跳回 该页面
        var pages = getCurrentPages(); // 获取栈实例
        console.log(pages, "pages>>>");
        if (pages.length === 1) {
            let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
            let currentPage = pages[pages.length - 1]["$page"]["fullPath"]; //当前页面路径(带参数)
            console.log(currentRoute, "currentRoute>>>", currentPage);
            uni.setStorageSync("loginBackUrl", currentPage);
        }
		
		console.log(this.fromshareId ,'??', this.isLogin)
        if (this.isLogin) {
			console.log('分享扫码关联')
			const params = {
			    salesmanId: this.fromshareId,
			    customerId: this.userInfo.id,
				associatedChannel:9//来源状态
			};
			followSalespersonsApi(params).then((res) => {
			    console.log(res, "关注接口成功");
			});
        }
		
		
		uni.setNavigationBarTitle({
			title: this.appName,
		});
        uni.setNavigationBarColor({
            frontColor: this.appName == '十蜂健康'  ? "" : "#ffffff",
            backgroundColor:this.backgroundColor,
            animation: {
                duration: 10,
            },
        });
    },
};
</script>

<style lang="scss" scoped></style>
